//----------------------------------------------------------
    // 最终功能测试，只需要引用"../src/ymbxlog.hpp"头文件即可实现日志的输出
//----------------------------------------------------------


#include "../src/ymbxlog.hpp"

using namespace ymbxlog;

void test_log(const std::string& name)
{
    rinfo("测试开始");
    Logger::ptr slp = GetLogger(name);
    if (slp.get() == nullptr)
    {
        std::cout << "不存在" << std::endl;
        // exit(0);
        return;
    }
    LOG_DEBUG(name,1,"DEBUG");
    LOG_INFO(name,2,"INFO");
    LOG_WARN(name,3, "WARNING");
    LOG_ERROR(name, 4,"ERROR");
    LOG_FATAL(name,5,"FATAL");
    // slp->debug( 1,"DEBUG");
    // slp->info( 2,"INFO");
    // slp->warn(3, "WARNING");
    // slp->error( 4,"ERROR");
    // slp->fatal( 5,"FATAL");
    rinfo("测试结束");
}
int main()
{
    // std::unique_ptr<LoggerBuilder> uplb(new GlobalLoggerBuild());
    // uplb->BuildLoggername("synclogger");
    // uplb->EnableLoggerSync();
    // uplb->BuildLimitLevel(LogLevel::Level::INFO);
    // uplb->BuildFormatter();
    // uplb->BuildSink<StdoutSink>();
    // uplb->BuildSink<FileSink>("./log/fileS/filesink.txt");
    // uplb->BuildSink<RollByFilesizeSink>("./log/rollbfS/rollbyfilesink");
    // uplb->BuildSink<RollByTimeSink>("./log/rollbts/rollbytimesink");
    // uplb->Build();

    //创建同步局部日志器
    Logger::ptr  lp1=CreatSyncLocalLogger("localsynclogger",LogLevel::Level::INFO);
    //创建同步全局日志器
    Logger::ptr lp2=CreatSyncGlobalLogger("globalsynclogger",LogLevel::Level::INFO);
    //创建异步线程安全全局日志器
    Logger::ptr lp3=CreatAsyncLocalLogger("localasynclogger",LogLevel::Level::INFO);
    //创建异步线程安全局部日志器
    Logger::ptr lp4=CreatAsyncGLobalLogger("globalasynclogger",LogLevel::Level::INFO);
    std::cout<<"局部同步日志器>>>\n";
    test_log("localsynclogger");

    std::cout<<"局部异步日志器>>>\n";
    test_log("localasynclogger");

    std::cout<<"全局同步日志器>>>\n";
    test_log("globalsynclogger");

    std::cout<<"全局异步日志器>>>\n";
    test_log("globalasynclogger");


    return 0;
}